<?xml version="1.0" encoding="ISO_8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:p="http://primefaces.org/ui">

<h:head>
</h:head>
	
<h:body>	
	<p:panel header="#{msg.componente_headerAdd}">	
		<h:form name="form1" style="border:none;text-align:right;">					
			
			<p:panelGrid columns="2">
				<p:column>	
					<p:panelGrid columns="2" style="border:none;">
			
						<p:outputLabel for="tipoCaracteristico" value="#{msg.componente_componente}"/>  
				        <p:selectOneMenu id="tipoCaracteristico" value="#{componentesMB.tipoCaracteristico}"   disabled="#{componentesMB.bloqueiaCamposFormCompontente}">  
				            <f:selectItem itemLabel="Selecione um tipo" itemValue="" />  
				            <f:selectItems value="#{componentesMB.tiposCaracteristicos}" />
				           <p:ajax event="change" update="tipoComponente,panelCaracteristicasComponentes,codigo,caracteristica1,caracteristica2,caracteristica3" listener="#{componentesMB.configuraForm(0)}"></p:ajax>   			            
				        </p:selectOneMenu>
				        
				        <p:outputLabel for="tipoComponente" value="#{msg.componente_pasta}"/>  
				        <p:selectOneMenu id="tipoComponente" value="#{componentesMB.tipoComponente}" disabled="#{componentesMB.bloqueiaCamposFormCompontente}">  
				            <f:selectItem itemLabel="Selecione uma pasta" itemValue="" />  
				            <f:selectItems value="#{componentesMB.tipoComponetes}" />		            
				             <p:ajax event="change" update="codigo" listener="#{componentesMB.listCodigo()}"></p:ajax>		                       
				        </p:selectOneMenu>	
				
						<p:outputLabel for="descricao" value="#{msg.componente_descricao}"/>	 
			 			<p:inputText id="descricao" value="#{componentesMB.componente.descricao}" readonly="#{componentesMB.bloqueiaCamposFormCompontente}" />	 	
			
						<p:outputLabel for="quantidade" value="#{msg.componente_quantidade}"/>				
				 		<p:inputText id="quantidade" value="#{componentesMB.componente.quantidade}" readonly="#{componentesMB.bloqueiaCamposFormCompontente}" />	 		
			 			
			 			<p:outputLabel for="tamanho" value="#{msg.componente_tamanho}"/>	 
			 			<p:inputText id="tamanho" value="#{componentesMB.componente.tamanho}" readonly="#{componentesMB.bloqueiaCamposFormCompontente}" />	
			 			
			 			<p:outputLabel for="valor_unitario" value="#{msg.componente_valor_unitario}"/>	 
			 			<p:inputText id="valor_unitario" value="#{componentesMB.componente.valor_unitario}" readonly="#{componentesMB.bloqueiaCamposFormCompontente}" />	
			 			
			 			<p:outputLabel for="fabricante" value="#{msg.componente_fabricante}"/>	 
			 			<p:inputText id="fabricante" value="#{componentesMB.componente.fabricante}" readonly="#{componentesMB.bloqueiaCamposFormCompontente}" />
			 			
			 			
			 			 <p:outputLabel for="codigo" value="#{msg.componente_codigo}"/>  
				        <p:selectOneMenu id="codigo" value="#{componentesMB.selectedCodigo}" disabled="#{componentesMB.bloqueiaCamposFormCompontente}">  
				             <f:selectItems value="#{componentesMB.codigos}" />	             		                       
				        </p:selectOneMenu>		
			 				 				
			 			</p:panelGrid>
		 			</p:column>	
		 			
		 			<p:column>
						<p:panelGrid columns="5" style="border:none;margin-left: 700px;margin-top: -150px;" rendered="#{componentesMB.renderBotoes}">
						
							<p:commandLink ajax="false" update="conteudo" action="#{componentesMB.setarParaEditar(componentesMB.componente)}">
								<p:graphicImage value="#{pageContext.servletContext.contextPath}/imagens/editar2.png" title="#{msg.column_edit}" />
								<f:setPropertyActionListener target="#{urlMB.url}" value="cad_componente.xhtml" />				
							</p:commandLink>
							
							<p:commandLink update=":formDeleteComponente" oncomplete="dlgDeleteComponente.show()" rendered="#{componentesMB.rendeDelete()}">
								<p:graphicImage value="#{pageContext.servletContext.contextPath}/imagens/lixeira2.png" title="#{msg.column_delete}" />
							</p:commandLink>
							
							<p:commandLink update=":formRetirarComponente" oncomplete="dlgRetirarComponente.show()" >
								<p:graphicImage value="#{pageContext.servletContext.contextPath}/imagens/ico_retira2.png" title="#{msg.column_retirar}" />				
								<f:setPropertyActionListener target="#{componentesMB.quantidadeDeRetirada}" value="#{componentesMB.componente.quantidade}" />
							</p:commandLink>
							
							<p:commandLink update=":formAddComponente" oncomplete="dlgAddComponente.show()" >
								<p:graphicImage value="#{pageContext.servletContext.contextPath}/imagens/ico_add2.png" title="#{msg.column_add}" />				
								<f:setPropertyActionListener target="#{componentesMB.quantidadeDeRetirada}" value="0" />
							</p:commandLink>
						
							<p:commandLink ajax="false" update="conteudo" >
								<p:graphicImage value="#{pageContext.servletContext.contextPath}/imagens/relatorio.png" title="#{msg.column_relatorio}" />
								<f:setPropertyActionListener target="#{urlMB.url}" value="gerar_relatorio.xhtml" />
								<f:setPropertyActionListener target="#{historicoMB.componente}" value="#{componentesMB.componente}" />
								<f:setPropertyActionListener target="#{historicoMB.visibilidadeBotaoGerarRelatorioComponente}" value="true" />
							    <f:setPropertyActionListener target="#{historicoMB.visibilidadeBotaoGerarRelatorioUsuario}" value="false" />
							    <f:setPropertyActionListener target="#{historicoMB.dataInicial}" value="" />
							    <f:setPropertyActionListener target="#{historicoMB.dataFinal}" value="" />
							</p:commandLink>			
						
						</p:panelGrid>	
					</p:column>
			
				</p:panelGrid>	
		 			
		 			<p:panel id="panelCaracteristicasComponentes" header="#{msg.componente_headerCaracteristicas}" style="width:31%;" visible="#{componentesMB.visibilidadePainelCaractersticasComponentes}">
		 				<p:panelGrid columns="2"  style="border:none;">
				 			<p:outputLabel for="caracteristica1" value="#{componentesMB.labelCaracteristica1}" rendered="#{componentesMB.renderCaracteristica1}"/>	 
				 			<p:inputText id="caracteristica1" value="#{componentesMB.caracteristica1}" rendered="#{componentesMB.renderCaracteristica1}" readonly="#{componentesMB.bloqueiaCamposFormCompontente}" />
				 			
				 			<p:outputLabel for="caracteristica2" value="#{componentesMB.labelCaracteristica2}" rendered="#{componentesMB.renderCaracteristica2}"/>	 
				 			<p:inputText id="caracteristica2" value="#{componentesMB.caracteristica2}" rendered="#{componentesMB.renderCaracteristica2}" readonly="#{componentesMB.bloqueiaCamposFormCompontente}" />
				 			
				 			<p:outputLabel for="caracteristica3" value="#{componentesMB.labelCaracteristica3}" rendered="#{componentesMB.renderCaracteristica3}"/>	 
				 			<p:inputText id="caracteristica3" value="#{componentesMB.caracteristica3}" rendered="#{componentesMB.renderCaracteristica3}" readonly="#{componentesMB.bloqueiaCamposFormCompontente}" />
				 		</p:panelGrid>
			 			
		 			</p:panel>	
		 				
					<p:panelGrid columns="2"  style="border:none;">
			 			<p:commandButton value="#{msg.button_save}" id="botao_save_cad"  ajax="false" action="#{componentesMB.salveOrUpdateComponente()}"  disabled="#{componentesMB.bloqueiaCamposFormCompontente}" >
			 				<f:setPropertyActionListener target="#{urlMB.url}" value="componentes.xhtml" />
			 			</p:commandButton>
			  			<p:commandButton value="#{msg.button_cancel}" id="botao_cancel_cad"  ajax="false" >
			  				<f:setPropertyActionListener target="#{urlMB.url}" value="componentes.xhtml" />
			  			</p:commandButton>
					</p:panelGrid>
				
				
				
		</h:form>	
	</p:panel>
				
</h:body>
</html>